package doyouknow.group.CnAndZhb.controller;

import doyouknow.group.CnAndZhb.service.GetVoiceService;
import doyouknow.group.CnAndZhb.entity.VoiceBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by star on 2020/10/29.
 */
@Controller
@CrossOrigin
public class VoiceController {
    @Autowired
    private GetVoiceService getVoiceService;

    @RequestMapping("/xmmap")
    @ResponseBody
    public String getVoiceById(){
        List<VoiceBean> result = getVoiceService.getVoice("203233829c3b");
        System.out.println(result.get(0));
        if(result.size()>0){
            return result.get(0).getXm_mac();
        }else{
            return "该网关没有绑定小度的迹象";
        }

    }

}
